<?php
return array(
	'tableName' => 'worker_account',
	'attributeLabels' => array(
		'id' => '账户',
		'worker_name' => '账户名',
		'worker_password' => '账户密码',
		'profile' => '账户详细资料',
		'baseInfo' => '账户基本资料',
		'status' => '状态',
		'rePassword' => '确定密码',
		'verifyCode' => '验证码'
	),
	
	'rules'=>array(
//		array('verifyCode,rePassword', 'required', 'on'=>'register'),
		array('verifyCode,rePassword', 'safe'),
		array('rePassword', 'compare', 'compareAttribute'=>'worker_password', 'on' => 'register', 'message'=>'两次密码不同.'),
//		array('verifyCode', 'captcha', 'on'=>'register', 'allowEmpty'=> !extension_loaded('gd')),
		
		array('worker_name','coms.validators.worker.UserUniqueValidator'),
		array('worker_name,worker_password', 'required'),
		array('worker_name,worker_password', 'length', 'max'=>32,'min'=>6),
	),
	
	
	'relations' => array(
		'profile' => array(CActiveRecord::HAS_ONE, 'AccountProfile', 'id'),
	),
	
	'behaviors' => array(
//		'pwd' => array(
//			'class' => 'application.behaviors.Md5Behavior',
//			'md5Attribute' => 'worker_password',
//		),
		'userScope' => array(
			'class' => 'coms.behaviors.userScopes.DefaultScope',
			'relatedFields' => array(
				'id',
			),
			'autoRun' => false,
		),
		'uidCreate' => array(
			'class' => 'coms.behaviors.worker.UCUserSyncBehavior',
		),
	),
	
	'cascade' => array(
		'profile',
	),
	
	'_import' => array(
		array('*', 'models.ActiveRecord//*'),
	),
);